/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */

// 递归
bool _isSymmetric(struct TreeNode* left, struct TreeNode* right){
    if(left == NULL && right == NULL)
        return true;     // 都为空树
    if(left == NULL || right == NULL)
        return false;    // 一个为空 一个不为空
    if(left->val != right->val)
        return false;
    return _isSymmetric(left->left, right->right) && \
           _isSymmetric(left->right, right->left);
}

bool isSymmetric(struct TreeNode* root){
    // 判断左右子树是否对称
    return _isSymmetric(root->left, root->right);
}